'use strict';

const Controller = require('egg').Controller;

class BrokerController extends Controller {
    async index() {
        const {
            ctx
        } = this;
        ctx.body = 'hi, egg';
    }

    //经纪人详情
    async brokerDetail() {
        const {
            ctx
        } = this;
        const {
            id
        } = ctx.request.body;
        // console.log(id, 'id...');
        const data = await this.app.mysql.get('broker', {
            id
        });
        ctx.body = data;
    }

    //经纪人卖房
    async brokerSell() {
        const {
            ctx
        } = this;
        const {
            id
        } = ctx.request.body;
        const data = await this.app.mysql.select('sellershouse', {
            where: {
                broker_id: id
            }
        })
        ctx.body = data;
    }
    //租房
    async brokerRenting() {
        const {
            ctx
        } = this;
        const {
            id
        } = ctx.request.body;
        const data = await this.app.mysql.select('rentinghouse', {
            where: {
                broker_id: id
            }
        })
        ctx.body = data;
    }
}

module.exports = BrokerController;